//封装分类数据相关业务代码
import { getCategoryAPI2 } from '@/apis/category';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';

export function useCategory() {
  //获取分类数据
  const categoryDate = ref({})
  const route = useRoute()
  const getCategory = async () => {
    const res = await getCategoryAPI2(route.params.id)
    // console.log(res)
    categoryDate.value = res.result
  }

  onMounted(() => {
    getCategory()
  })

  return{
    categoryDate
  }
}
